import React, {Component} from "react";
import Forms from '@/components/common/Form'
import ReactQuill from '@/components/common/ReactQuill'
export default class AddNews extends Component {
    componentDidMount () {
        if (this.props.onChildEventFAun) { this.props.onChildEventFAun(this) }
    }
    childVm = null
    reactquill = React.createRef()
    onChildEventFAun = childVm => {
        this.childVm = childVm
    }
    getFieldsValue = () => {
        return {
            ...this.childVm.getFieldsValue(true),
            ...{reactquill: this.reactquill.current.state.curValue}
        }
    }
    state = {
        formList: [
            {
                type: 'input',
                name: 'newsTitle',
                label: '新闻标题',
            }
        ]
    }
    render () {
        const { formList } = this.state
        return (
            <div>
                <Forms onChildEventFAun={ this.onChildEventFAun } formList={formList} noBtn={true} />
                <ReactQuill ref={this.reactquill} />
            </div>
        )
    }
}
